home *** CD-ROM | disk | FTP | other *** search
- #1z
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MultiCalc 1.0
-
- A Precision Calculator
-
- for the
-
- Commodore AMIGA
-
- November 1, 1988
-
- Kenneth Johnson
-
-
-
-
-
-
- Introduction
-
- The purpose of this document is to describe the features
- of MultiCalc 1.0 and help the user make the most of them.
- This program originated as an exercise in curiosity - both in
- terms of the methods used to compute the standard functions
- on a scientific calculator and with regard to the features of
- the AMIGA. I have never seen a high-precision general
- purpose calculator on a computer, and I thought it might be a
- useful addition to AMIGA public domain programs as well as a
- good first project for myself.
-
- MultiCalc 1.0 is not blazingly fast. It is optimized
- for doing operations with precision from 50 to around 3000
- digits. However, dealing with numbers this large is always
- slow, and this program is no exception. The slowest opera-
- tions are those involving inverse trigonometric functions: I
- would not recommend using these functions with precision over
- 100 unless you have plenty of time to wait. The program can
- handle numbers of any size up to 32000 digits. If you need
- greater precision than this, I would recommend buying time on
- a supercomputer!
-
- In designing the program I opted to use a Reverse Polish
- Notation (RPN) stack-based format. Memory is allocated
- dynamically, so your stack size is only limited by the amount
- of available memory. If you are not familiar with stack
- based calculators, the concept is quite simple: all opera-
- tions are computed on the numbers at the top of the stack,
- and the <Enter> key is used to place numbers on the stack.
- There is an indicator at the top of the display that indicat-
- ing the current depth of the stack. I have implemented a
- circular stack - the number shown in the display is always
- the top of the stack. Moving down places the top item at the
- bottom of the stack, and moving up places the bottom item at
- the top of the stack.
-
- I hope that this program will be useful. It is fairly
- compact, requiring only 24K of Chip memory, and I used an
- adaptation of Leo Schwab's iconify routine so that it can be
- loaded without cluttering the screen when not in use. Still,
- it is far from perfect, and suggestions for improvement are
- always welcome. Please address any correspondence to:
-
- Kenneth Johnson
- 3018 Trail's End NW
- Albuquerque, NM 87120
-
-
-
-
-
-
- Getting Started
-
- MultiCalc 1.0 can be started from either the Workbench
- or CLI. The program takes one optional argument, namely the
- numeric precision. This can be any number from 20 to 32000;
- anything else will result in the default precision of 48 (the
- size of the display). A sample call is as follows:
-
- 1> MultiCalc 500
-
- This would bring up the calculator with a precision of 500
- digits. Keep in mind that you cannot change the precision
- once the program has started, so if you will be dealing with
- very large or very small numbers, you should set the preci-
- sion accordingly.
-
- When running from the Workbench, it is only necessary to
- double-click on the MultiCalc 1.0 icon. The precision will
- default to 48, but it can be set with a Tool Type entry. To
- make this entry, select the icon from Workbench and then
- selct the Info item from the Workbench menu. You can then
- ADD a Tool Type entry as follows:
-
- PRECISION=500
-
- This entry would set the calculator's precision to 500
- digits. Finally, you must press the SAVE gadget on the
- bottom left corner of the Info window. It is important that
- the entry be made in capital letters and without any spaces.
- Once this is done, double-clicking on the calculator icon
- will bring up MultiCalc 1.0 with the desired precision.
-
-
-
-
-
-
- Entering Numbers and Using the Stack
-
- Almost every feature of MultiCalc 1.0 can be accessed
- either with the mouse or the keyboard. Numbers can be
- entered with the mouse by clicking on the number gadgets in
- the calculator window, using the left mouse button. Each
- click is registered upon releasing the mouse button, so if
- you change your mind about a digit, simply move the mouse
- away from the gadget before releasing the button. If a
- mistake is made in entering a number, the BackSpace gadget
- can be used to remove one digit at a time.
-
- Using the keyboard, the digits can be entered using
- either the numeric keypad or the regular typewriter numbers.
- The space bar is used to change the sign of the number, and
- the BACK SPACE key is used to back up one digit at a time.
- Keep in mind while backspacing that the decimal point (.)
- will "absorb" a back space, even though the display will not
- change when this happens.
-
- The <RETURN> and <ENTER> keys are used to add numbers to
- the stack. When either is pressed, the number currently in
- the display is duplicated and placed on top of the stack, so
- that a number can easily be entered many times. However, if
- any digit is pressed at this point, the display will be
- initialized and a new number will be started. In this case,
- BACK SPACE has the same function as the Clear button ('c' on
- the keyboard): the display is cleared and initialized to
- zero. However, the Change Sign button (space bar on the
- keyboard) will not initialize the display - it merely changes
- the sign of the current entry.
-
- If the number is larger that the display, the left and
- right arrow keys can be used to shift the display to the left
- and right, respectively. Also, the SHIFT key can be used in
- conjunction with the arrow keys on the keyboard to shift the
- display to the left and right ends of the number. The up and
- down arrow keys are used to rotate through the contents of
- the stack. The Swap button (HELP key on the keyboard)
- switches the places of the top two entries of the stack.
-
- If a number key is pressed after using any of the
- arithmetic, function, or stack-manipulation keys, a new entry
- is added to the stack automatically, and the preivious
- contents of the display are preserved as the second item on
- the stack. However, the BACK SPACE and Clear buttons retain
- their function of merely resetting the contents of current
- display entry to zero.
-
- Finally, the Delete button (SHIFT-DEL from the keyboard)
- is used to remove an entry from the stack. If there is only
- one entry on the stack, this button acts like the Clear
- button.
-
-
-
-
-
-
- Use of Function Keys
-
- All of the arithmetic and other function keys are
- available from both mouse and keyboard. For the keyboard
- equivalents, please see the Summary of Keyboard Functions
- below. There are some special considerations with regard to
- a few of these functions, and these are detailed in this
- section.
-
- First, it is important to keep in mind that all binary
- operations use the two numbers on the top of the stack. In
- some cases, the order of these numbers is important. When
- using the division operator, the divisor is taken to be the
- number on the top of the stack. In raising a number to a
- power, the power is the number on top. Finally, Rectal
- coordinates are stored with the y coordinate on top, while
- Polar coordinates are stored with the angle on top.
-
- There are three buttons that define how the calculator
- will deal with the trigonometric functions. Unlike other
- buttons on the calculator, these three register a change as
- soon as the mouse button is pressed, instead of when it is
- released. First, the Radians/Grads/Degrees button is used to
- define the unit of angle measurement. This affects the
- trigonometric functions (except when in Hyperbolic mode) as
- well as the Polar to Rectal and Rectal to Polar conversions.
- The default mode is Radians, so be aware of this if you need
- to use something else.
-
- The Trigonometric/Hyperbolic and Normal/Inverse buttons
- only affect the outcome of the Trigonometric functions. The
- default is Normal-Trigonometric, and the calculator is always
- returned to this state after a Trigonometric operation.
-
- Finally, the Fix button is used to restrict the display
- to a specified number of digits after the decimal point. It
- is important to keep in mind that this does not truncate the
- number in any way - only the display of the number is affect-
- ed. To use this feature, simply enter the number of digits
- desired and press the Fix button. The display will then be
- cleared and ready to accept input for another number. Any
- fractional portion is ignored when using this function, and
- the number zero is used to signify a full display. When
- entering numbers in this mode, it is possible to continue
- entering digits past the cutoff. These will not be seen, but
- can nevertheless be edited in the standard way.
-
-
-
-
-
-
- The Menu
-
- The menu provides several additional non-numeric func-
- tions to the calculator. The 'About...' item does nothing
- especially useful, but gives some information about the
- product. The 'Delimited' flag pertains to the 'Save Stack'
- item and will be discussed with it below.
-
- The 'Iconify' item causes the calculator window to
- disappear and a small icon to take its place. My thanks to
- Leo Schwab for providing the inspiration for and the basic
- form of the routine that takes care of this function. This
- icon can then be moved around the display, and out of the way
- of other activities. In order to reopen the calculator
- window, simply double-click on the icon.
-
- The 'Load Stack' item will fill the stack with numbers
- that are stored in ASCII form in a file. Most commonly this
- will be used to restore numbers saved using the 'Save Stack'
- item, but it can also be used in conjunction with any text
- editor to load any numbers of your choice into the calcula-
- tor. Invoking this option will bring up a requester for the
- name of the file from which to load the numbers. Simply
- click on the box to enter the name of the file, and click on
- the 'Accept' gadget to initiate the load.
-
- The 'Save Stack' item takes the contents of the stack
- and saves them in a file. The procedure is similar to that
- involved in 'Load Stack' above. However, the 'Delimited'
- item in the menu can be selected or deselected to indicate
- whether you want your output to be delimited by commas and
- spaces. Also, if the file already exists, the current stack
- will be appended to the end of its contents, otherwise a new
- file will be created.
-
- The 'Quit' option does just what its name implies - it
- terminates the program. Keep in mind that several of the
- menu items can be invoked with their keyboard equivalents
- using the Right-Amiga key.
-
-
-
-
-
-
- Summary of Keyboard Functions
-
- * Multiplication
- / Division
- + Addition
- - Subtraction
- SPACE Change Sign
- c Clear Display
- BACK SPACE Delete a Digit
- SHIFT-DEL Delete a Number from the Stack
- RETURN Add a Number to the Stack
- ENTER Add a Number to the Stack
-
- HELP Swap the Top Two Stack Entries
- Up Arrow Rotate the Stack Up
- Down Arrow Rotate the Stack Down
- Left Arrow Shift the Display to the Left
- Right Arrow Shift the Display to the Right
- SHIFT-Left Arrow Shift the Display to the Left End
- SHIFT-Right Arrow Shift the Display to the Right End
-
- ESC Rotate Radians/Grads/Degrees
- F5 Rotate Trigonometric/Hyperbolic
- F10 Rotate Normal/Inverse
-
- F1 Log Base 10
- F2 Log Base e
- F3 10 Raised to a Power
- F4 e Raised to a Power
- F6 Sin/Sinh/ArcSin/ArcSinh
- F7 Cos/Cosh/ArcCos/ArcCosh
- F8 Tan/Tanh/ArcTan/ArcTanh
- F9 Pi
-
- SHIFT-F1 Reciprocal
- SHIFT-F2 Square a Number
- SHIFT-F3 Raise a Number to a Power
- SHIFT-F4 Raise a Number to a Reciprocal Power
- SHIFT-F6 Change Rectal to Polar
- SHIFT-F7 Change Polar to Rectal
- SHIFT-F8 Fix the Number of Decimal Digits
- SHIFT-F9 Factorial
-
- Amiga-I Iconify
- Amiga-L Load the Stack from a File
- Amiga-S Save the Stack to a File
- Amiga-Q Exit the Program
-
-
-
-
-
-
- Copyright Notice
-
- MultiCalc is copyright 1988 by Kenneth Johnson. The
- binary code may be distributed free of charge in any form as
- long as this document is included with it. Special permis-
- sion must be obtained to distribute MultiCalc for a fee, and
- this permission is extended to all not-for-profit User's
- Groups to defray copy and distribution costs, as well as to
- those distributing collections of AMIGA public domain soft-
- ware.
-
- If you find that MultiCalc 1.0 is particularly useful,
- or if you have any questions, comments, or suggestions for
- future improvements, or if you would like a copy of the
- source code, donations and other correspondence should be
- addressed to:
-
- Kenneth Johnson
- 3018 Trail's End NW
- Albuquerque, NM 87120
-
- Enjoy!
-
- c